/*
 Cogumelo v0.1 - INNOTO
Copyright (C) 2010 Innoto Gestión para el Desarrollo Social S.L. <mapinfo@innoto.es>

This program is free software; you can redistribute it and/or
modify it under the2009 terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
USA.
*/

/*
 * NOTE: jquery.qtip. The jQuery tooltip plugin is Licensed under MIT
 * http://www.opensource.org/licenses/mit-license.php
 * Copyright (c) 2009 Craig Thompson
 * http://craigsworks.com
 * 
 * this function is licensed by Innoto Gestión para el Desarrollo Social S.L. <mapinfo@innoto.es>
 * Copyright (C) 2010
 */

function tooltipSniffer(selector, options) {
	if(ie6) return;
	var defaults = {
	   	position: {
			corner: {
				target: 'topMiddle',
				tooltip: 'bottomRight'
			}
		},
		show: { delay: 30 },
		style: { name: 'gzsaude' }
	};
	$.extend(true, defaults, options);
	var sel = (selector) ? selector : '*[tooltip]';
	$(sel).each(function(i, e){
		if($(e).attr('tts') != 'skip' && $(e).attr('tts') != 'exception') {
			$.extend(true, defaults, {content: $(e).attr('tooltip')});
			$(e).qtip(defaults);
		}
	});	
}

if(!ie6) {
	$(document).ready(function()
	{
		tooltipSniffer();
		var style2 = {
				position: {
					corner: {	tooltip: 'bottomLeft'	}
				},
				style: {
					tip: {	corner: 'bottomLeft'	}
				}
			};
		$.each($('*[tts=exception]'), function(i, ex) {
			$(ex).removeAttr('tts');
			tooltipSniffer(ex, style2);
			$(ex).attr('tts', 'exception');
		});
	});
}